import Network from './network'

// 注册
export const registerUser = (data: Object) => Network.post('/register', data)
// 发送邮箱验证码
export const emailCode = (email: string) => Network.get(`/emailcode?email=${email}`)
// 登录
export const loginUser = (data: Object) => Network.post('/login', data)


// 获取所有用户列表
export const getUsers = () => Network.get('/api/v1/users')
// 获取用户列表（关键字）
export const getUserPage = (data:Object) => Network.get('/api/v1/userpage',data)
// 获取单个用户信息
export const getOneUserInfo = (id:string) => Network.get(`/api/v1/users/${id}`)
// 添加用户
export const addUsers = (data:Object) => Network.post('/api/v1/users',data)
// 删除用户
export const delUsers = (id:string) => Network.delete(`/api/v1/users/${id}`)
// 编辑用户
export const updateUsers = (id:string,data:Object) => Network.put(`/api/v1/users/${id}`,data)


// 获取角色列表 
export const getRoles = (data:Object) => Network.get('/api/v1/roles',data)
// 新增角色
export const getAddRoles = (data:Object) => Network.post('/api/v1/roles',data)

export const text = () => Network.get('/test')
